package networkSimulation.framework

/**
 * Trait to export the fields of a class
 *
 * @author  Tim Caljé
 *          Jeroen De Raedt
 *          Jorick Van Aken
 */
trait FieldExporter {

  /**
   * Export the fields of this class
   *
   * @return  Array[xml.Elem]
   *          The XML representation of the fields
   */
  def exportFields() = {
    for(field <- getClass().getDeclaredFields())
      yield <field name={field.getName()}>{ this.getClass().getMethods.find(_.getName == field.getName()).get.invoke(this) }</field>
  }
}